home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000105_icon-group-sender _Mon Mar 9 07:53:33 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id HAA20893
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 9 Mar 1998 07:53:32 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA11144; Mon, 9 Mar 1998 07:53:32 -0700
  7. Message-Id: <3500B606.2C3A@gte.net>
  8. Date: Fri, 06 Mar 1998 20:50:46 -0600
  9. From: Mark Evans <evans@gte.net>
  10. Reply-To: evans@gte.net
  11. Organization: None
  12. X-Mailer: Mozilla 3.01 (Win95; I)
  13. Mime-Version: 1.0
  14. To: icon-group@optima.CS.Arizona.EDU
  15. Subject: Radio Buttons in VIB
  16. References: <9803052117.AA07739@ cynic.org>
  17. Content-Type: text/plain; charset=us-ascii
  18. Content-Transfer-Encoding: 7bit
  19. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  20. Status: RO
  21. Content-Length: 1917
  22.  
  23. Maybe someone can straighten me out about radio buttons in the VIB.  I
  24. have a four-element radio button "vidget" in VIB.  All that I want to do
  25. is assign numbers, 0,1,2,3,4 to each button.  However my need for
  26. descriptive text next to each number means I can't use the string
  27. version of the number for the value.  Furthermore, the number shown on
  28. the screen is off-by-one from the actual button number.  Button #1 has
  29. value 0, button #2 has value 1, etc.
  30.  
  31. So it appears that I need a whole apparatus to handle this simple
  32. object.
  33.  
  34. - a list of the string ID's in the vidget
  35.      (duplicating the VIB entry, very error prone if I
  36.       change the VIB entry)
  37. - a table to lookup numbers by a string key (the text shown in the
  38. vidget)
  39. - two symmetrical conversion procedures
  40.  
  41.  
  42.  
  43. Seems like overkill to me -- someone help?  It seems that what is needed
  44. is a call that can return the *numerical* value of the vidget instead of
  45. the *string* value.  The vidget already knows the strings and their
  46. relative positions.  Is there a way just to get the number?  Am I
  47. missing something simple?
  48.  
  49.  
  50.  
  51. Here is what I'm doing.
  52. _____________________________________________________________
  53.  
  54. global shannon_strings,shannon_table,shannon_order
  55.  
  56. # input = integer, 0-3
  57. procedure shannon_get_str(order)
  58.    return shannon_strings[order+1]
  59. end
  60.  
  61.  
  62. # input = string, one of the shannon_strings
  63. # the shannon_table is initialized inside init_world()
  64. procedure shannon_get_order(str)
  65.    return (shannon_table[str] | 0)
  66. end
  67.  
  68.  
  69. procedure init_world()
  70.    local i
  71.  
  72.    shannon_strings := ["0: Letters Same","1: Letters Different","2:
  73. Digraph","3:                 Trigraph","4: Quadgraph"]
  74.    shannon_table := table("")
  75.    every i := 1 to *shannon_strings do
  76.    {
  77.       insert(shannon_table,shannon_strings[i],i-1)
  78.    }
  79.  
  80.    shannon_order := 2
  81.    
  82.    #default setting at startup
  83.   
  84. VSetState(vidgets["radio_button_ShannonOrder"],shannon_get_str(shannon_order)) 
  85.  
  86. end
  87.  
  88.